<template>
  <UView name="点位组">
    <UViewSearch v-model="searchModel">
      <URow col="search">
        <UInput field="name" label="组名称" :allowClear="true"/>
        <UFuncBtn func="query" url="/iot/pointGroup/view">搜索</UFuncBtn>
        <UFuncBtn func="reset">重置</UFuncBtn>
        <UFuncBtn func="add" url="/iot/pointGroup/add" v-auth="'iot:pointGroup:add'">新增</UFuncBtn>
      </URow>
    </UViewSearch>
    <UViewModal title="点位组管理" :span="[7, 14]" v-model="editModel" :rules="rules">
      <template #default="{model}">
        <UInput field="name" label="组名称" />
        <UInputNumber field="modelId" label="所属型号" />
      </template>
      <template #footer>
        <UFuncBtn func="cancel">取消</UFuncBtn>
        <UFuncBtn func="submit" url="/iot/pointGroup/saveOrUpdate">提交</UFuncBtn>
        <UFuncBtn func="reset">重置</UFuncBtn>
      </template>
    </UViewModal>
    <UViewTable :columns="columns">
      <template #action="{record}">
        <UFuncTag func="edit" :data="record" url="/iot/pointGroup/edit" v-auth="'iot:pointGroup:edit'">修改</UFuncTag>
        <UFuncTag func="del" :data="record" url="/iot/pointGroup/del" v-auth="'iot:pointGroup:del'">删除</UFuncTag>
      </template>
    </UViewTable>
  </UView>
</template>
<!-- 点位组功能 -->
<script>
import {ref, reactive} from "vue";
export default {
  name: "PointGroup",
  setup() {
    let columns = ref([
          {field: "name", title: "组名称"},
          {field: "modelId", title: "所属型号"},
          {field: "createTime", title: ""},
          {field: 'action', title: '操作', type: 'action'},
      ]);

    let rules = reactive({
        name: {required: true, message: '组名称必填'},
        modelId: {required: true, message: '所属型号必填'},
        createTime: {required: true, message: '必填'},
    })

    let editModel = ref({});
    let searchModel = ref({});
    return {columns, rules, editModel, searchModel}
  },
}
</script>
<style scoped> </style>